-- Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
--
-- this file licensed under the Mulan PSL v2.
-- You can use this software according to the terms and conditions of the Mulan PSL v2.
-- You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2
--
-- THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
-- PURPOSE.
-- See the Mulan PSL v2 for more details.
--
-- Author: auto generate
-- Create: 2025-5-9
-- Description: DO NOT EDIT; Code generated by "message.lua.mako"
local validate = require 'mc.validate'
local utils = require 'mc.utils'
local mdb = require 'mc.mdb'

local Local = {}

---@class Local.StandbyAllowed
---@field StandbyAllowed boolean
local TStandbyAllowed = {}
TStandbyAllowed.__index = TStandbyAllowed
TStandbyAllowed.group = {}

local function TStandbyAllowed_from_obj(obj)
    return setmetatable(obj, TStandbyAllowed)
end

function TStandbyAllowed.new(StandbyAllowed)
    return TStandbyAllowed_from_obj({StandbyAllowed = StandbyAllowed or false})
end
---@param obj Local.StandbyAllowed
function TStandbyAllowed:init_from_obj(obj)
    self.StandbyAllowed = obj.StandbyAllowed or false
end

function TStandbyAllowed:remove_error_props(errs, obj)
    utils.remove_obj_error_property(obj, errs, TStandbyAllowed.group)
end

TStandbyAllowed.from_obj = TStandbyAllowed_from_obj

TStandbyAllowed.proto_property = {'StandbyAllowed'}

TStandbyAllowed.default = {false}

TStandbyAllowed.struct = {{name = 'StandbyAllowed', is_array = false, struct = nil}}

function TStandbyAllowed:validate(prefix, errs, need_convert)
    prefix = prefix or ''

    validate.Optional(prefix .. 'StandbyAllowed', self.StandbyAllowed, 'bool', true, errs, need_convert)

    TStandbyAllowed:remove_error_props(errs, self)
    validate.CheckUnknowProperty(self, TStandbyAllowed.proto_property, errs, need_convert)
    return self
end

function TStandbyAllowed:unpack(_)
    return self.StandbyAllowed
end

Local.StandbyAllowed = TStandbyAllowed

---@class Local.ActiveAllowed
---@field ActiveAllowed boolean
local TActiveAllowed = {}
TActiveAllowed.__index = TActiveAllowed
TActiveAllowed.group = {}

local function TActiveAllowed_from_obj(obj)
    return setmetatable(obj, TActiveAllowed)
end

function TActiveAllowed.new(ActiveAllowed)
    return TActiveAllowed_from_obj({ActiveAllowed = ActiveAllowed or false})
end
---@param obj Local.ActiveAllowed
function TActiveAllowed:init_from_obj(obj)
    self.ActiveAllowed = obj.ActiveAllowed or false
end

function TActiveAllowed:remove_error_props(errs, obj)
    utils.remove_obj_error_property(obj, errs, TActiveAllowed.group)
end

TActiveAllowed.from_obj = TActiveAllowed_from_obj

TActiveAllowed.proto_property = {'ActiveAllowed'}

TActiveAllowed.default = {false}

TActiveAllowed.struct = {{name = 'ActiveAllowed', is_array = false, struct = nil}}

function TActiveAllowed:validate(prefix, errs, need_convert)
    prefix = prefix or ''

    validate.Optional(prefix .. 'ActiveAllowed', self.ActiveAllowed, 'bool', true, errs, need_convert)

    TActiveAllowed:remove_error_props(errs, self)
    validate.CheckUnknowProperty(self, TActiveAllowed.proto_property, errs, need_convert)
    return self
end

function TActiveAllowed:unpack(_)
    return self.ActiveAllowed
end

Local.ActiveAllowed = TActiveAllowed

---@class Local.Id
---@field Id integer
local TId = {}
TId.__index = TId
TId.group = {}

local function TId_from_obj(obj)
    return setmetatable(obj, TId)
end

function TId.new(Id)
    return TId_from_obj({Id = Id or 0})
end
---@param obj Local.Id
function TId:init_from_obj(obj)
    self.Id = obj.Id or 0
end

function TId:remove_error_props(errs, obj)
    utils.remove_obj_error_property(obj, errs, TId.group)
end

TId.from_obj = TId_from_obj

TId.proto_property = {'Id'}

TId.default = {0}

TId.struct = {{name = 'Id', is_array = false, struct = nil}}

function TId:validate(prefix, errs, need_convert)
    prefix = prefix or ''

    validate.Optional(prefix .. 'Id', self.Id, 'uint8', true, errs, need_convert)

    TId:remove_error_props(errs, self)
    validate.CheckUnknowProperty(self, TId.proto_property, errs, need_convert)
    return self
end

function TId:unpack(_)
    return self.Id
end

Local.Id = TId

---@class Local.SwitchStatusRsp
local TSwitchStatusRsp = {}
TSwitchStatusRsp.__index = TSwitchStatusRsp
TSwitchStatusRsp.group = {}

local function TSwitchStatusRsp_from_obj(obj)
    return setmetatable(obj, TSwitchStatusRsp)
end

function TSwitchStatusRsp.new()
    return TSwitchStatusRsp_from_obj({})
end
---@param obj Local.SwitchStatusRsp
function TSwitchStatusRsp:init_from_obj(obj)

end

function TSwitchStatusRsp:remove_error_props(errs, obj)
    utils.remove_obj_error_property(obj, errs, TSwitchStatusRsp.group)
end

TSwitchStatusRsp.from_obj = TSwitchStatusRsp_from_obj

TSwitchStatusRsp.proto_property = {}

TSwitchStatusRsp.default = {}

TSwitchStatusRsp.struct = {}

function TSwitchStatusRsp:validate(prefix, errs, need_convert)
    prefix = prefix or ''

    TSwitchStatusRsp:remove_error_props(errs, self)
    validate.CheckUnknowProperty(self, TSwitchStatusRsp.proto_property, errs, need_convert)
    return self
end

function TSwitchStatusRsp:unpack(_)
end

Local.SwitchStatusRsp = TSwitchStatusRsp

---@class Local.SwitchStatusReq
---@field Status integer
local TSwitchStatusReq = {}
TSwitchStatusReq.__index = TSwitchStatusReq
TSwitchStatusReq.group = {}

local function TSwitchStatusReq_from_obj(obj)
    return setmetatable(obj, TSwitchStatusReq)
end

function TSwitchStatusReq.new(Status)
    return TSwitchStatusReq_from_obj({Status = Status})
end
---@param obj Local.SwitchStatusReq
function TSwitchStatusReq:init_from_obj(obj)
    self.Status = obj.Status
end

function TSwitchStatusReq:remove_error_props(errs, obj)
    utils.remove_obj_error_property(obj, errs, TSwitchStatusReq.group)
end

TSwitchStatusReq.from_obj = TSwitchStatusReq_from_obj

TSwitchStatusReq.proto_property = {'Status'}

TSwitchStatusReq.default = {0}

TSwitchStatusReq.struct = {{name = 'Status', is_array = false, struct = nil}}

function TSwitchStatusReq:validate(prefix, errs, need_convert)
    prefix = prefix or ''

    validate.Optional(prefix .. 'Status', self.Status, 'uint8', false, errs, need_convert)

    TSwitchStatusReq:remove_error_props(errs, self)
    validate.CheckUnknowProperty(self, TSwitchStatusReq.proto_property, errs, need_convert)
    return self
end

function TSwitchStatusReq:unpack(_)
    return self.Status
end

Local.SwitchStatusReq = TSwitchStatusReq

Local.interface = mdb.register_interface('bmc.kepler.Managers.ActiveStandby.Local', {
    Id = {'y', {}, true, 0, false},
    ActiveAllowed = {'b', {}, true, false, false},
    StandbyAllowed = {'b', {}, true, false, false}
}, {SwitchStatus = {'a{ss}y', '', TSwitchStatusReq, TSwitchStatusRsp}}, {})

return Local
